import request from '../utils/request';
import { PAGE_SIZE } from '../constants'

export function fetch(query) {
    return request(`/api/users?limit=${PAGE_SIZE}`, {
        method: 'GET',
        body: query
    });
}

export function find({ id }) {
    return request(`/api/users/${id}`);
}

export function post({ values }) {
    return request(`/api/users`, {
        method: 'POST',
        body: JSON.stringify(values)
    })
}

export function patch({ id, values }) {
    return request(`/api/users/${id}`, {
        method: 'PATCH',
        body: JSON.stringify(values)
    })
}

export function remove({ id }) {
    return request(`/api/users/${id}`, {
        method: 'DELETE'
    })
}

export function batchRemove({ id }) {
    return request('/api/users', {
        method: 'DELETE',
        body: JSON.stringify(id)
    })
}
